#ifndef __RTGUI_CTRLBAR_H__
#define __RTGUI_CTRLBAR_H__

#include <rtthread.h>
#include <rtgui/rtgui_app.h>
#include <rtgui/widgets/window.h>

#include <rtgui/rtgui_xml.h>
#include <dfs_posix.h>
#include <string.h>


DECLARE_CLASS_TYPE(ctrlbar);
/** Gets the type of a ctrlbar */
#define RTGUI_CTRLBAR_TYPE       (RTGUI_TYPE(ctrlbar))
/** Casts the object to a ctrlbar control */
#define RTGUI_CTRLBAR(obj)       (RTGUI_OBJECT_CAST((obj), RTGUI_CTRLBAR_TYPE, struct geo_ctrlbar_view))
/** Checks if the object is a ctrlbar control */
#define RTGUI_IS_CTRLBAR(obj)    (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_CTRLBAR_TYPE))

struct geo_ctrlbar_item
{
	const char *text;
	rt_bool_t (*cmd)(struct rtgui_object *object, void *args);
};

struct geo_ctrlbar
{	
	struct rtgui_rect extent;
	struct geo_ctrlbar_item *items;
	int count;
	int index;
	rt_int16_t w, h;
	rt_bool_t (*draw_item)(struct geo_ctrlbar *m, struct rtgui_dc *dc, int index);
};

struct geo_ctrlbar_module
{
	const char *title;
	char *path;
	//char *file;
	struct 
	{
		struct geo_ctrlbar_item *items;
		int count;
		rt_bool_t (*draw_item)(struct geo_ctrlbar *m, struct rtgui_dc *dc, int index);
	}bar, menu;
};

struct geo_ctrlbar_view
{
	struct rtgui_widget widget;
	const char *title;
	char *path;
	//int count;
	//int index;
	struct geo_ctrlbar *focus, *client, *bar, *menu;
	rt_uint32_t flag;
};
typedef struct geo_ctrlbar_view geo_ctrlbar_t;


struct geo_ctrlbar_view *geo_ctrlbar_create(void);//(struct rtgui_rect *rect);
void geo_ctrlbar_destroy(struct geo_ctrlbar_view *ctrlbar);
//void geo_ctrlbar_load_module(struct geo_ctrlbar_module *m, const struct geo_ctrlbar_item *items, int size);
//void geo_ctrlbar_load_module(struct geo_ctrlbar_view *ctrlbar, const struct geo_ctrlbar_module *module);
//void geo_ctrlbar_layout(struct geo_ctrlbar_view *ctrlbar, struct rtgui_rect *rect, rt_uint32_t align);

#endif
